package com.zhouyu.fileSync.FSserver;

import com.zhouyu.fileSync.FScommon.commonUtils.ConfigReader;
import com.zhouyu.fileSync.FSserver.entities.ServerConfigs;
import com.zhouyu.fileSync.FSserver.registerServer.RegisterServer;

import java.io.IOException;

/**
 * Created by zhouyu@lightinthebox.com on 2019/8/8
 **/
public class ServerAppContext {
    public static ServerConfigs CONFIGS;

    public static void main(String[] args) throws IOException {
        initConfig(ServerAppContext.class.getClassLoader().getResource("serverConfig.yml").getPath());
        startRegisterServer();
    }

    private static void initConfig(String filePath) throws IOException {
        CONFIGS = ConfigReader.readConfigs(filePath, ServerConfigs.class);
    }
    private static void startRegisterServer(){
        RegisterServer registerServer = new RegisterServer();
        Thread t1 = new Thread(registerServer);
        t1.start();
    }
}
